//
// Created by root on 2/18/18.
//

#ifndef FUNNY_TRANSLATOR_GRAPH_H
#define FUNNY_TRANSLATOR_GRAPH_H

#include "queue.h"

typedef struct _GraphNode {
    char *id;
    void *element;
    int inDegree;
    int tempInDegree;
    Queue *adjList;
} GraphNode;

typedef struct _Graph {
    int vertexCount;
    int edgeCount;
    Queue *nodes;
} Graph;

GraphNode *alloc_graph_node();

Graph *init_graph();

void add_vertex(Graph *g, char *id, void *element);

void add_edge(Graph *g, char *src, char *dest);

Queue *topological_sort(Graph *g);

#endif //FUNNY_TRANSLATOR_GRAPH_H
